package com.biodiv.community.config;

import com.alibaba.cloud.ai.dashscope.api.DashScopeResponseFormat;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: tianquan
 * @date: 2025-07-15  09:56
 */
@Configuration
public class DashScopeResponseFormatConfig {

    /**
     * 创建一个JSON对象格式的响应格式对象
     */
    @Bean
    public DashScopeResponseFormat responseJsonFormat() {
        DashScopeResponseFormat responseFormat = new DashScopeResponseFormat();
        responseFormat.setType(DashScopeResponseFormat.Type.JSON_OBJECT);
        return responseFormat;
    }

    /**
     * 创建一个文本格式的响应格式对象
     */
    @Bean
    public DashScopeResponseFormat responseTextFormat() {
        DashScopeResponseFormat responseFormat = new DashScopeResponseFormat();
        responseFormat.setType(DashScopeResponseFormat.Type.TEXT);
        return responseFormat;
    }

}

